 /// @file ExchangePMIDatum.h
 /// @brief ExchangePMIDatum 
 /// @copyright Copyright (c) 2025  Hefei Jiushao Intelligent Technology Co., Ltd. All rights reserved.
 /// @createtime 2025-04-07

#ifndef EXCHANGECOREPMIDATUM_H
#define EXCHANGECOREPMIDATUM_H
#include "ExchangePMIBase.h"
#include "vector"
#include <memory>

namespace  AMCAX::Exchange::Core::PMI {

enum class PMIDatumTargetType
{
    Unknown,
    Point,
    Line,
    AreaCircular,
    AreaRectangular,
    AreaFace,
    Feature,
    UserDefined
} ;

ENUM_TO_STRING_CASE_ALL(
    PMIDatumTargetType,
    ENUM_CASE(PMIDatumTargetType,Unknown)
    ENUM_CASE(PMIDatumTargetType,Point)
    ENUM_CASE(PMIDatumTargetType,Line)
    ENUM_CASE(PMIDatumTargetType,AreaCircular)
    ENUM_CASE(PMIDatumTargetType,AreaRectangular)
    ENUM_CASE(PMIDatumTargetType,AreaFace)
    ENUM_CASE(PMIDatumTargetType,Feature)
    ENUM_CASE(PMIDatumTargetType,UserDefined)
)

class ExchangePMIDatumTarget : public ExchangePMIAnnotation
{
public:
    PMIAnnotationType GetType() const override
	{
		return PMIAnnotationType::DatumTarget;
	} 
    
    void SetLabel(const std::string &l){
        this->label = l ; 
    } ;
    void SetTargetType(const PMIDatumTargetType &t){
        this->targetType = t ; 
    } ;
    void SetHasDiameter(bool hasDiameter){
        this->hasDiameter = hasDiameter ; 
    } ;
    void SetUpperText(const std::string &ut){
        this->upperText = ut ; 
    } ;
    void SetLowerText(const std::string &lt){
        this->lowerText = lt ; 
    } ;
    void SetPosition1(float x, float y, float z){
        this->position1[0] = x ; 
        this->position1[1] = y ; 
        this->position1[2] = z ; 
    } ;
    void SetPosition2(float x, float y, float z){
        this->position2[0] = x ; 
        this->position2[1] = y ; 
        this->position2[2] = z ; 
    } ;

    std::string ToString() override ;
private:
    std::string label ;
    PMIDatumTargetType targetType ;
    bool hasDiameter ;
    std::string upperText ;
    std::string lowerText ;
    float position1[3] ;
    float position2[3] ;
} ;

class PMIExchangeDatum : public ExchangePMIAnnotation
{  
public:
    PMIAnnotationType GetType() const override
	{
		return PMIAnnotationType::Datum;
	} 

    void SetLabel(const std::string &l){
        this->label = l ; 
    } ;

    void AddDatumTarget(const std::shared_ptr<ExchangePMIDatumTarget> &datumTarget){
        this->datumTargets.push_back(datumTarget) ;
    } ;

    std::string ToString() override ;
private:
    std::string label ;
    std::vector<std::shared_ptr<ExchangePMIDatumTarget>> datumTargets ;
} ;

}

#endif